// 2255. 统计是给定字符串前缀的字符串数目
// AC: https://leetcode.cn/problems/count-prefixes-of-a-given-string/submissions/614648058/

class Solution {
public:
    int countPrefixes(vector<string>& words, string s) {
        set<string> st;
        string ss;
        for(auto x:s){
            ss+=x;
            st.insert(ss);
        }
        int ans=0;
        for(int i=0;i<words.size();++i){
            if(st.find(words[i])!=st.end())
                ans++;
        }
        return ans;
    }
};